package com.dcits.components.threadpools;

import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;

@Component
public class ExecutorRegistry {
    private final ConcurrentHashMap<String, Executor> pools = new ConcurrentHashMap<>();

    public void register(String name, Executor executor) {
        pools.put(name, executor);
    }

    public Map<String, Executor> getExecutorMap() {
        return Collections.unmodifiableMap(pools);
    }
}
